﻿using System.ServiceProcess;
using System.Threading;

namespace YEA.Monitor.NotificationService
{
    public partial class NotificationManagerService : ServiceBase
    {
        private readonly Controller c;
        private readonly Thread threadController;
        public NotificationManagerService()
        {
            c = new Controller();
            InitializeComponent();
            threadController = new Thread(c.Start);
        }

        protected override void OnStart(string[] args)
        {
            if (threadController.ThreadState == ThreadState.Running)
                c.Start();
            else
                threadController.Start();
        }

        protected override void OnStop()
        {
            c.Stop();
        }
        protected override void OnPause()
        {
            c.Pause();
        }
        protected override void OnContinue()
        {
            c.Continue();
        }
    }
}
